home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr28
/
dats520.zip
/
DATECHK.DOC
< prev
next >
Wrap
Text File
|
1995-02-13
|
11KB
|
253 lines
Date Check ver 5.20
_______________________________________________________________________________
What is Date Check?
Date Check was created out of necessity to automatically perform
daily, weekly and monthly maintenance that needs to be done (and if you are like
me, forget without fail!)
How do I use Date Check?
Date Check is very simple to use. Just copy it to your main directory,
and make it the last line in your AUTOEXEC.BAT. Also make sure the
COMSPEC environment variable is set to identify the command interpreter
you are using. (If you are using NDOS, Date Check automatically takes
care of the descriptions of it's work files.) Create a batch file
called "DAILY.BAT" for daily maintenance, and a batch file called
"MONTHLY.BAT" for monthly maintenance, and a batch file called "WEEKLY.BAT"
for weekly maintenance. You may omit any combination of the batch files if
you please. If you wish, run DATECHK /CHECK to verify that your batch
files are running properly. Use the /AUTO switch on the command line, to do
maintenance unprompted. Do not mix the /AUTO and the /CHECK switches! If
you do, Date Check will use neither switch!
User time intervals now implemented. Also added the option for
Yearly checks. Use "USER.BAT" and "YEARLY.BAT", respectively. Date Check
will automatically recognize an older Date Check record file, or none at
all, and prompt for a User interval. Enter "0" to not use this option. As
a consequence, DATECHK.REC should, after the upgrade, be 5 bytes. You may
use any user interval, in days, 1-511, theoretically. I recommend sticking
within the range 2-365, as these are the logical values anyone would want
to use, in my opinion. Any other value above 511, and the program will
strip off the lowest-order bits, and shift the highest-order 9 bits to the
right. (If you are not a programmer, don't worry about it, just DON'T do it.)
DATECHK.REC should no longer exist. (Let the upgrade take care it!).
Date Check Zips
Like a lot of programmers have been doing lately, I have
taken to giving naming rules to my ZIP files.
DAT [NS|S] VER
In other words, version 99 with source would be named DATS99.ZIP
...and without source DATNS99.zip
Not too difficult, I hope...
Revision History
ver .5 ßeta
Original version of program... One word... SUCKED!!! Only could
handle monthly and daily maintenance, and had a few glitches in the
algorithm.
ver .99 ßeta
Added Weekly Maintenance. Also added a few diagnostic options, to
check for bugs more efficiently. Problem with weekly maintenance,
I had to use someone else's code until I could correct it. Didn't
want do, because of possible copyright infringements.
ver 1.00
Finally perfected weekly code. Was informed by someone that the year
2000 was NOT a leap year, although it is divisible by 4. Created code
to count up days, and then get the modulus for the weekday. Optimized
the code so some delays were taken care of. This is about as best as
the program can get. Decided to release it to public.
ver 1.01
Ok, so it wasn't the best... I fixed a bug for when Datechk would
be first run, it would give me an overflow error. I also
compressed the date storage. (Ok, so it was small to begin with...
I did it just to see if I could do it...) I reduced the file from 12
bytes to 3 bytes. No big deal, but I intend to use the technology
in other programs I have. The program will automatically erase and
update the old DATE.REC.
ver 1.02
I optimized the routines, reduced code from constants to loops, and
reduced the DATE.REC to 2 bytes... (Yes I'm obsessed with trying to
see what I can do.)
ver 1.03
Further optimization, and Found out that the year 2000 is, in fact,
a leap year. Would not have run into problems till year 2000, but
I hate a messy program.
ver 1.04
Added capability to choose whether or not to execute the batch
files
ver 2.00
I've optimized ALL of the routines to the best of my ability for
speed I also put most of the key options in CONST statements, for
ease in customizing. I've decided that I would finally just release
this program into the public domain, considering that
1. No one sent me money (Damn!!!)
2. I have been mainly programming this for myself
Because of this, I've also decided that I'd also release the
QuickBasic source code, and you can customize the program for you
own needs. I will release a version in C a few months down the
road, and to make it easier on myself, I've been practicing
programming in structured code, since C has no "GOTO" statement.
Other minor changes:
1. DATE.REC is now DATECHK.REC
2. Optimized "Days" function... MUCH faster than the original
3. Moved most Module-level code into Subs and Functions, to reduce
data storage needs
ver 2.10
I've cut out the diagnostic code, because of it taking up to much
programming time. (Normally not noticeable to the public, but use
the /manip switch on the dos command line in versions 2.0 and
earlier.) Added the /AUTO switch, which allows you to do
maintenance unprompted.
ver 2.20
Further code optimization. Cut out some more code, for which the only
reason it was there was to support the "/MANIP" function cut out of
the last version.
ver 3.00
USER.BAT and YEARLY.BAT now implemented. Removed more unnecessary
code. Debugged USER and YEARLY routines.
ver 3.50
Maintenance release. Added funny looking files. Current files
included are:
DATECHK.EXE Main Executable
DATECHK.DAT Data File
DATECHK.REC Date Check Record File (Should not exist initially!)
README.COM You are reading this!
DATECHK.BAS Date Check Source Code
FILE_ID.DIZ
ver 3.51
Maintenance release.
ver 3.60
Deleted DATECHK.REC. Current Files Are (AFTER FIRST RUN!!!):
DATECHK.EXE\
DATECHK.DAT/ Only files NEEDED to run!!! MUST be in same
directory.
README.COM
DATECHK.BAS
LISTDATA.BAS\
MAKEDATA.BAS/ Example programs. Explained in Tech. Section.
FILE_ID.DIZ
ver 3.61
MAJOR maintenance release. It is recommended that you either run
this version, or ver 3.51. Last version had bugs in the ReadDate$
function.
ver 4.00
Redesigned DATECHK.DAT. Make sure you copy new file over the old
one. Major code rewrite.
ver 5.00
Major code re-write. DATECHK.BAS has now been re-written for
Visual Basic for DOS ver 1.00. I did this to take advantage of VB's
advanced functions. DATECHK.BAS can no longer be run in QB. LISTDATA and
MAKEDATA can be run in either Visual Basic for DOS or QB 4.5.
ver 5.20
Bug fixes, Cosmetic improvements. Further optimizations for use
under VB for DOS. More code reductions.
Technical Section:
I though I would add this section so that beginning programmers do
not screw up the program Data Files. The DATECHK.DAT is not meant to
Hex-Edit, but since there are people who would try it anyway...
The DAT file is divided as such:The first record is 5 bytes, and should NOT
be altered. The first 5 bytes are actually bit fields. This is how it works...
| || || | | || |
43215432 17654321 98765432 19876543 21UNUSED
00000000 00000000 00000000 00000000 00000000
Field Meaning
1 Current Recorded Month
2 Current Recorded Day
3 Current Recorded (Year - 1980)
4 Recorded User Interval
5 Recorded Accumulation till next User event
To decide whether or not to execute "USER.BAT", the program checks Field 4
against Field 5. If they are equal, Field 5 is set to "000000000" and the
count begins again. For all others, Fields 1,2,3 are checked against the
current date.
The rest of the file is in 62-byte records, as follows:
First two bytes are as previous date record, with the "Year" field being
ignored The next 60 are a message to pop up on the previous record's date.
Being the Holidays, I came up with the Idea that the program could also
wish the user a happy "whatever". I like the idea... :) I've included in
this version 2 example programs for working with Datechk.DAT. ListData
outputs a file, called "OUTPUT.LST" that lists the current holidays stored
in the DATECHK.DAT. Programmers note: ReadDate$ function is slightly
different than the one in DATECHK.BAS. Do not interchange! MakeData will
either add on to a current DATECHK.DAT, or make a new one.
Programmers Notes:
Complete rewrite of the following functions:
ReadDate$ function - Now TranslateDate$. Interperates any 2-byte
string into the MM-DD-YYYY format.
InitDateCheck sub - Added support for the new TranslateDate$
function.
HolidayCheck sub - Files are no longer opened as RANDOM files. All
files are opened as BINARY. Eliminated the need to open the same file two
different ways. IMPORTANT! Now Record.Date is DIRECTLY passed to the new
Translate function.
Main Module - Support for TranslateDate$ added.
ver 5.00 Programmers update.
FixBin$, Num2Bin$, Bin2Num, Logx no longer necessary! I figured
out how to use the "AND" operator for Binary operations. I also kicked
myself in the head for not thinking of it earlier! :). Removed about 5k
worth of code that was unnecessary with VB for DOS. All interfaces and
functions do the same thing, although some functions have been re-written
for optimization.
_______________________________________________________________________________
One last word... Good Luck to all you programmers and
hackers out there, wherever you are!!!! :)
-Brian Fields
Who do I contact in case of problems?
Contact:
Brian Fields
22 Bellview Rd.
Marysville, PA 17053
(717) 957-4921
I would like to express my thanks to the following people:
R. Bradford (Fubar) Peters - for help with the code, and
distribution.
Jonathan Stevens - for teaching me some of the code used herein.
Gerald Eltringham - for putting up with me for the last THREE
years, and for continuing to do so :).